﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _05.Nfact_kFact_kfact_nfact
{
    class nk_kn
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Insert k!k>n>1");
            Console.Write("k= ");
            decimal k = decimal.Parse(Console.ReadLine());
            Console.Write("n= ");
            decimal n = decimal.Parse(Console.ReadLine());
            decimal nRes = 1, kRes = 1;
            if (k > n && n > 1)
            {
                for (int i = 1; i <=k; i++)
                {
                    kRes *= i;
                }
                for (int j = 1; j <=n; j++)
                {
                    nRes *=j;
                }
                Console.WriteLine("n!*k!/(k-n)! = " + (nRes*kRes)/(kRes-nRes));
            }
            else 
            {
                Console.ForegroundColor = ConsoleColor.DarkRed;
                Console.WriteLine("Error!k>n>1!Try again later");
            }
        }
    }
}
